<?php
session_start();
	ini_set("include_path", "/");
	require_once 'ClsSebent/Product_class.php';

$_SESSION['USERTYPE']='buyer';
$_SESSION['SITE_ID']=101;

		$Product=new Product_class;
		
	if(isset($_POST["img_del_local"]))
	{
		$Product->Product_id=$_POST["img_del_local"];
		$Product->Site_id=$_SESSION["SITE_ID"];
		$Product->Delete_SiteProduct();
	}
	elseif(isset($_POST["img_del_master"]))
	{
		$Product->Product_id=$_POST["img_del_master"];
		$Product->Site_id=$_SESSION["SITE_ID"];
		$Product->Delete_Product();
		
	}
	elseif(isset($_POST["img_edit_product"]))
	{
		$Product->Product_id=$_POST["img_edit_product"];
		$_SESSION["PRODUCT_ID"]=$Product->Product_id;
		header("Location: product_update.php");
	}
	/*elseif(isset($_POST["img_edit_local"]))
	{
		$Product->Product_id=$_POST["img_edit_local"];
	}*/
		
		
header("header: Update_Product.php");
?>


<form action="product_listing.php" method="post" name="frm_product_listing">
</script>
<table width="100%" border="1">
      <tr>
        <td colspan="14"><div align="center"><strong>Products List 
        <select name="Product_Listorder">
          <option value="product_category" selected>By Category</option>
          <option value="product_title">By Title</option>
		  <option value="product_price">By Price</option>
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <input type="submit" name="btn_Listing" value="Get Listing">
</strong></div></td>
        </tr>
		<tr>
			<td colspan="14"><input type="hidden" id="now_product_id" name="now_product_id"><div id="div_message">
			<?php 
			echo "<h2><font color='red'>".$Product-> Message."</font></h2>";;
			?>
			</div>
			</td>
		</tr>
		<!-- HEADER ROW FOR PRODUCT LISTINGS -->
      <tr>
        <td width="2%"><div align="center"><input type="hidden" name="now_product_id" value=""></div></td>
<!--    <td width="2%"><div align="center"></div></td>-->
        <td width="2%"><div align="center"></div></td>
        <td width="2%"><div align="center"></div></td>
        <td width="16%"><div align="center"><strong>Product</strong></div></td>
        <td width="12%"><div align="center"><strong>Category</strong></div></td>
        <td width="9%"><div align="center"><strong>Price</strong></div></td>
        <td width="7%"><div align="center"><strong>Profit % </strong></div></td>
        <td width="7%"><div align="center"><strong>Profit</strong></div></td>
        <td width="10%"><div align="center"><strong>Selling Price </strong></div></td>
        <td width="6%"><div align="center"><strong>Tax % </strong></div></td>
        <td width="6%"><div align="center"><strong>Tax</strong></div></td>
        <td width="8%"><div align="center"><strong>Shipping</strong></div></td>
        <td width="11%"><div align="center"><strong>Final Price </strong></div></td>
      </tr>
	  <!-- DATA ROW FOR PRODUCT LISTINGS -->
	  <?php 
	  	if(isset($_POST["btn_Listing"]) || isset($_POST["img_del_local"]) || isset($_POST["img_del_master"]))
		{
			$Product->Product_Listorder=$_POST["Product_Listorder"];
			$Product->List_Products();
		}  
	  ?>
	  <!-- HEADER ROW ENDS HERE -->
      <tr>
        <td colspan="14">&nbsp;</td>
      </tr>
    </table>
</form>